<template>
	<div id="content">
		<Header />
		<div class="bread">
			<div class="cont w1200">
				<img src="../../../assets/img/location.png" alt=""><a><router-link
						to="/portal/index">首页</router-link></a> > <a><router-link
						to="/portal/net">网谷里</router-link></a>><a>民情动态</a>
				<a href="" class="back"><img src="../../../assets/img/back.png" alt=""><router-link
						to="/portal/net">返回上一级</router-link></a>
			</div>
		</div>
		<div class="inner">
			<div class="net w1200">
				<h3>民情动态</h3>
				<div class="form">
					<div class="form-left">
						<div class="btnL">
							<img src="../../../assets/img/left-bar1-hover.png" alt="">
							<img src="../../../assets/img/left-bar1.png" alt=""><router-link
								to="/portal/net/trendsAdd">新建动态</router-link>
						</div>
						<div class="btnL active">
							<img src="../../../assets/img/left-bar2-hover.png" alt="">
							<img src="../../../assets/img/left-bar2.png" alt=""><router-link
								to="/portal/net/trends">历史记录</router-link>
						</div>
					</div>
					<div class="form-right">
						<div class="title">
							<div class="line"></div>历史记录
						</div>
						<div class="form-detail">
							<div class="form-list" v-for="item in trendsList" @click="goDetail(item.opinionId)">
								<h5 style="font-weight: bold">{{ item.title }}</h5>
								<p v-html="item.content"></p>
								<div class="text"></div>
								<div class="operate">
									<div class="left">
										<span style="margin-right: 50px;">联系对象：{{ item.contactPerson }}</span> <span
											style="margin-right: 50px;">联系人：{{ item.voterName
											}}</span> <span style="margin-right: 50px;">提交时间： {{ item.submitTime
											}}</span>
									</div>
									<div class="right">
										<div class="status red" v-if="item.voterStatus == 0">未处理</div>
										<div class="status red" v-if="item.voterStatus == 1">待办</div>
										<div class="status red" v-if="item.voterStatus == 2">办结</div>
										<!--<div class="delete"><img src="../../../assets/img/delete.png" alt="">删除</div>-->
									</div>
								</div>
							</div>
							<div class="page">
								<pagination v-show="total > 0" :total="total" :page.sync="pageNum"
									:limit.sync="pageSize" @pagination="init" />
							</div>
						</div>
					</div>
				</div>

			</div>
		</div>
		<Contact />
	</div>

</template>

<script>
import Header from '@/components/Header';
import Contact from '@/components/Contact';
import { findByVoterId, getTrendsList } from "@/api/website";

export default {
	data() {
		return {
			trendsList: [],
			userInfo: {},
			total: 0,
			pageNum: 1,
			pageSize: 10
		}
	},
	components: {
		Header,
		Contact
	},
	created() {
		this.userInfo = JSON.parse(sessionStorage.getItem("useInfo"))
		this.init()
	},
	mounted() {

	},
	methods: {
		init() {
			findByVoterId({ voterId: this.userInfo.id, pageNum: this.pageNum, pageSize: this.pageSize }).then(response => {
				this.trendsList = response.rows;
				this.total = response.total
			});
		},
		goDetail(id){
			this.$router.replace({ path: '/portal/net/trendsDetail' + '?id=' + id })
		}
	}

};
</script>

<style scoped lang="scss"></style>
